{
    "resourceType": "Bundle",
    "id": "BundleSurgery2Test",
    "meta": {
        "profile": [
            "https://fhir.by/AbstractArea/StructureDefinition/Bundle/MedicationDocument"
        ]
    },
    "identifier": {
        "system": "https://fhir.by/ValueSet/urn:ietf:rfc:3086",
        "value": "{{$guid}}"
    },
    "type": "document",
    "timestamp": "2025-11-15T16:00:00Z",
    "entry": [
        {
            "fullUrl": "Composition/CompositionSurgery2Test",
            "resource": {
                "resourceType": "Composition",
                "id": "CompositionSurgery2Test",
                "meta": {
                    "profile": [
                        "https://fhir.by/StructureDefinition/CompDocument"
                    ]
                },
                "status": "final",
                "type": {
                    "coding": [
                        {
                            "system": "https://fhir.by/ValueSet/CompositionType",
                            "code": "general",
                            "display": "Общая медицинская информация"
                        }
                    ]
                },
                "subject": [
                    {
                        "reference": "Patient/PatientTest"
                    }
                ],
                "date": "2025-11-15T16:00:00Z",
                "author": [
                    {
                        "reference": "Practitioner/{{PractitionerId}}"
                    }
                ],
                "title": "CompDocument для наполненного Bundle по оперативному вмешательству",
                "custodian": {
                    "reference": "Organization/{{OrganizationId}}"
                },
                "event": [
                    {
                        "detail": [
                            {
                                "reference": {
                                    "reference": "Condition/NailConditionTest"
                                }
                            }
                        ]
                    },
                    {
                        "detail": [
                            {
                                "reference": {
                                    "reference": "Encounter/EncounterSurgeonPostoperative2Test"
                                }
                            }
                        ]
                    },
                    {
                        "detail": [
                            {
                                "reference": {
                                    "reference": "Procedure/NailTest"
                                }
                            }
                        ]
                    }
                ]
            }
        },
        {
            "fullUrl": "Patient/PatientTest",
            "resource": {
                "resourceType": "Patient",
                "id": "PatientTest",
                "meta": {
                    "profile": [
                        "https://fhir.by/StructureDefinition/PatientWithIdentificationNumber"
                    ]
                },
                "extension": [
                    {
                        "extension": [
                            {
                                "url": "https://fhir.by/StructureDefinition/ConsentPersonalDataBoolean",
                                "valueBoolean": true
                            },
                            {
                                "url": "https://fhir.by/StructureDefinition/ConsentPersonalDataPeriod",
                                "valuePeriod": {
                                    "start": "2025-01-01"
                                }
                            }
                        ],
                        "url": "https://fhir.by/StructureDefinition/ConsentPersonalData"
                    }
                ],
                "identifier": [
                    {
                        "use": "usual",
                        "type": {
                            "coding": [
                                {
                                    "system": "https://fhir.by/ValueSet/PersonalDocumentType",
                                    "code": "INP",
                                    "display": "Уникальный идентификационный номер"
                                }
                            ]
                        },
                        "value": "7551374A009PB9"
                    },
                    {
                        "extension": [
                            {
                                "extension": [
                                    {
                                        "url": "https://fhir.by/StructureDefinition/PassportIssuedString",
                                        "valueString": "Центральным РУВД г Минска, 21.08.2021"
                                    },
                                    {
                                        "url": "https://fhir.by/StructureDefinition/PassportIssuedDate",
                                        "valueDate": "2021-08-21"
                                    },
                                    {
                                        "url": "https://fhir.by/StructureDefinition/PassportIssuedCode",
                                        "valueCodeableConcept": {
                                            "coding": [
                                                {
                                                    "system": "https://fhir.by/ValueSet/OCAM",
                                                    "code": "710"
                                                }
                                            ]
                                        }
                                    }
                                ],
                                "url": "https://fhir.by/StructureDefinition/PassportIssued"
                            }
                        ],
                        "use": "usual",
                        "type": {
                            "coding": [
                                {
                                    "system": "https://fhir.by/ValueSet/PersonalDocumentType",
                                    "code": "Passport-RB",
                                    "display": "Паспорт гражданина Республики Беларусь"
                                }
                            ]
                        },
                        "value": "MP2334555"
                    }
                ],
                "active": true,
                "name": [
                    {
                        "family": "Иванов",
                        "given": [
                            "Петр",
                            "Сидорович"
                        ]
                    }
                ],
                "telecom": [
                    {
                        "system": "phone",
                        "value": "375295748410"
                    },
                    {
                        "system": "email",
                        "value": "test_mail@gmail.by"
                    }
                ],
                "gender": "male",
                "birthDate": "1990-12-31",
                "deceasedBoolean": false,
                "address": [
                    {
                        "extension": [
                            {
                                "url": "https://fhir.by/StructureDefinition/CoutryForAddresses",
                                "valueCodeableConcept": {
                                    "coding": [
                                        {
                                            "system": "https://fhir.by/ValueSet/CitizenshipCode",
                                            "code": "BY",
                                            "display": "Беларусь"
                                        }
                                    ]
                                }
                            },
                            {
                                "url": "https://fhir.by/StructureDefinition/StreetGeoRegistry",
                                "valueCodeableConcept": {
                                    "coding": [
                                        {
                                            "system": "https://fhir.by/ValueSet/StreetGeoRegistry",
                                            "code": "5170309411",
                                            "display": "Улица Золотая Горка"
                                        }
                                    ]
                                }
                            },
                            {
                                "url": "https://fhir.by/StructureDefinition/ApartmentRoom",
                                "valueString": "кв. 29"
                            }
                        ],
                        "use": "home",
                        "text": "г.Минск, Улица Золотая Горка, д.5, кв.29",
                        "postalCode": "220022"
                    },
                    {
                        "extension": [
                            {
                                "url": "https://fhir.by/StructureDefinition/CoutryForAddresses",
                                "valueCodeableConcept": {
                                    "coding": [
                                        {
                                            "system": "https://fhir.by/ValueSet/CitizenshipCode",
                                            "code": "BY",
                                            "display": "Беларусь"
                                        }
                                    ]
                                }
                            },
                            {
                                "url": "https://fhir.by/StructureDefinition/StreetGeoRegistry",
                                "valueCodeableConcept": {
                                    "coding": [
                                        {
                                            "system": "https://fhir.by/ValueSet/StreetGeoRegistry",
                                            "code": "51703019678",
                                            "display": "Проспект Рокоссовского"
                                        }
                                    ]
                                }
                            },
                            {
                                "url": "https://fhir.by/StructureDefinition/ApartmentRoom",
                                "valueString": "кв. 2"
                            }
                        ],
                        "use": "temp",
                        "text": "г.Минск, Проспект Рокоссовского, д.20, кв.2",
                        "postalCode": "220011"
                    }
                ],
                "maritalStatus": {
                    "coding": [
                        {
                            "system": "https://fhir.by/ValueSet/MaritalStatus",
                            "code": "married"
                        }
                    ]
                },
                "contact": [
                    {
                        "relationship": [
                            {
                                "coding": [
                                    {
                                        "system": "https://fhir.by/ValueSet/RelatedPersonType",
                                        "code": "wife"
                                    }
                                ]
                            }
                        ],
                        "name": {
                            "family": "Иванова",
                            "given": [
                                "Лариса",
                                "Ивановна"
                            ]
                        },
                        "telecom": [
                            {
                                "system": "phone",
                                "value": "802990990908"
                            }
                        ]
                    }
                ],
                "generalPractitioner": [
                    {
                        "reference": "Organization/365de972-ed7f-453e-8515-865f4c4230c2",
                        "identifier": {
                            "value": "5526",
                            "period": {
                                "start": "2008-12-11"
                            }
                        }
                    }
                ]
            }
        },
        {
            "fullUrl": "Encounter/EncounterSurgeonPostoperative2Test",
            "resource": {
                "resourceType": "Encounter",
                "id": "EncounterSurgeonPostoperative2Test",
                "meta": {
                    "profile": [
                        "https://fhir.by/StructureDefinition/EncounterGeneral"
                    ]
                },
                "extension": [
                    {
                        "url": "https://fhir.by/StructureDefinition/EncounterTypeOfVisit",
                        "valueCodeableConcept": {
                            "coding": [
                                {
                                    "system": "https://fhir.by/ValueSet/EncounterTypeOfVisit",
                                    "code": "primary",
                                    "display": "первичное обращение"
                                }
                            ]
                        }
                    },
                    {
                        "url": "https://fhir.by/StructureDefinition/EncounterTypeOfService",
                        "valueCodeableConcept": {
                            "coding": [
                                {
                                    "system": "https://fhir.by/ValueSet/EncounterTypeOfService",
                                    "code": "free",
                                    "display": "Бесплатные услуги"
                                }
                            ]
                        }
                    }
                ],
                "status": "completed",
                "class": [
                    {
                        "coding": [
                            {
                                "system": "https://fhir.by/ValueSet/VSTermsOfService",
                                "code": "3",
                                "display": "в условиях отделения дневного пребывания"
                            }
                        ]
                    }
                ],
                "priority": {
                    "coding": [
                        {
                            "system": "https://fhir.by/ValueSet/HealthCareForms",
                            "code": "planned",
                            "display": "Плановая медицинская помощь"
                        }
                    ]
                },
                "type": [
                    {
                        "coding": [
                            {
                                "system": "https://fhir.by/ValueSet/TypeOfHealthCare",
                                "code": "special",
                                "display": "Специализированная медицинская помощь"
                            }
                        ]
                    }
                ],
                "subject": {
                    "reference": "Patient/PatientTest"
                },
                "serviceProvider": {
                    "reference": "Organization/{{OrganizationId}}"
                },
                "participant": [
                    {
                        "actor": {
                            "reference": "PractitionerRole/{{PractitionerRole}}"
                        }
                    }
                ],
                "actualPeriod": {
                    "start": "2025-11-15T12:00:21Z",
                    "end": "2025-11-15T12:25:21Z"
                },
                "reason": [
                    {
                        "use": [
                            {
                                "coding": [
                                    {
                                        "system": "https://fhir.by/ValueSet/EncounterReasons",
                                        "code": "consult",
                                        "display": "врачебная консультация"
                                    }
                                ]
                            }
                        ]
                    }
                ],
                "diagnosis": [
                    {
                        "condition": [
                            {
                                "reference": {
                                    "reference": "Condition/NailConditionTest"
                                }
                            }
                        ],
                        "use": [
                            {
                                "coding": [
                                    {
                                        "system": "https://fhir.by/ValueSet/TypeOfDiagnosis",
                                        "code": "mainDiagnosis"
                                    }
                                ]
                            }
                        ]
                    }
                ]
            }
        },
        {
            "fullUrl": "Condition/NailConditionTest",
            "resource": {
                "resourceType": "Condition",
                "id": "NailConditionTest",
                "meta": {
                    "profile": [
                        "https://fhir.by/StructureDefinition/FinalDiagnosis"
                    ]
                },
                "extension": [
                    {
                        "url": "https://fhir.by/StructureDefinition/KindOfDiagnosis",
                        "valueCodeableConcept": {
                            "coding": [
                                {
                                    "system": "https://fhir.by/ValueSet/KindOfDiagnosisCode",
                                    "code": "Final"
                                }
                            ]
                        }
                    },
                    {
                        "url": "https://fhir.by/StructureDefinition/AssertedDate",
                        "valueDateTime": "2025-11-15T15:15:00Z"
                    },
                    {
                        "url": "https://fhir.by/StructureDefinition/CourseOfDisease",
                        "valueCodeableConcept": {
                            "coding": [
                                {
                                    "system": "https://fhir.by/ValueSet/CourseOfDisease",
                                    "code": "acute"
                                }
                            ]
                        }
                    },
                    {
                        "url": "https://fhir.by/StructureDefinition/FirstTimeRevealed",
                        "valueBoolean": true
                    }
                ],
                "clinicalStatus": {
                    "coding": [
                        {
                            "system": "http://terminology.hl7.org/CodeSystem/condition-clinical",
                            "code": "active"
                        }
                    ]
                },
                "code": {
                    "coding": [
                        {
                            "system": "https://fhir.by/ValueSet/InternClassificDiseases10",
                            "code": "L60.0",
                            "display": "L60.0 - Вросший ноготь"
                        }
                    ]
                },
                "subject": {
                    "reference": "Patient/PatientTest"
                },
                "onsetDateTime": "2025-11-15",
                "recordedDate": "2025-11-15",
                "participant": [
                    {
                        "actor": {
                            "reference": "PractitionerRole/{{PractitionerRole}}"
                        }
                    }
                ]
            }
        },
        {
            "fullUrl": "Procedure/NailTest",
            "resource": {
                "resourceType": "Procedure",
                "id": "NailTest",
                "meta": {
                    "profile": [
                        "https://fhir.by/StructureDefinition/SurgicalProcedure"
                    ]
                },
                "extension": [
                    {
                        "url": "https://fhir.by/StructureDefinition/FromOrganization",
                        "valueReference": {
                            "reference": "Organization/{{OrganizationId}}"
                        }
                    },
                    {
                        "url": "https://fhir.by/StructureDefinition/EncounterTypeOfService",
                        "valueCodeableConcept": {
                            "coding": [
                                {
                                    "system": "https://fhir.by/ValueSet/EncounterTypeOfService",
                                    "code": "free",
                                    "display": "Бесплатные услуги"
                                }
                            ]
                        }
                    },
                    {
                        "url": "https://fhir.by/StructureDefinition/TermsOfService",
                        "valueCodeableConcept": {
                            "coding": [
                                {
                                    "system": "https://fhir.by/ValueSet/VSTermsOfService",
                                    "code": "3",
                                    "display": "в условиях отделения дневного пребывания"
                                }
                            ]
                        }
                    },
                    {
                        "url": "https://fhir.by/StructureDefinition/AnesthesiaType",
                        "valueCodeableConcept": {
                            "coding": [
                                {
                                    "system": "https://fhir.by/ValueSet/AnesthesiaType",
                                    "code": "local",
                                    "display": "местная анестезия"
                                }
                            ]
                        }
                    },
                    {
                        "url": "https://fhir.by/StructureDefinition/ProcedureUrgency",
                        "valueCodeableConcept": {
                            "coding": [
                                {
                                    "system": "https://fhir.by/ValueSet/ProcedureUrgency",
                                    "code": "planned",
                                    "display": "Плановое"
                                }
                            ]
                        }
                    }
                ],
                "identifier": [
                    {
                        "value": "13589",
                        "assigner": {
                            "reference": "Organization/{{OrganizationId}}"
                        }
                    }
                ],
                "status": "completed",
                "category": [
                    {
                        "coding": [
                            {
                                "system": "https://fhir.by/ValueSet/ProcedureType",
                                "code": "radical",
                                "display": "Радикальная"
                            }
                        ]
                    }
                ],
                "code": {
                    "coding": [
                        {
                            "system": "https://fhir.by/ValueSet/SurgicalInterventions",
                            "code": "QDSH20",
                            "display": "Коррекция деформации ногтевой пластины пальца стопы"
                        }
                    ],
                    "text": "Коррекция деформации ногтевой пластины пальца стопы"
                },
                "subject": {
                    "reference": "Patient/PatientTest"
                },
                "encounter": {
                    "reference": "Encounter/EncounterSurgeonPostoperative2Test"
                },
                "occurrencePeriod": {
                    "start": "2025-11-15T12:00:00Z",
                    "end": "2025-11-15T12:20:00Z"
                },
                "performer": [
                    {
                        "function": {
                            "coding": [
                                {
                                    "system": "https://fhir.by/ValueSet/OperatingTeam",
                                    "code": "operator",
                                    "display": "врач-хирург оперирующий"
                                }
                            ]
                        },
                        "actor": {
                            "reference": "PractitionerRole/{{PractitionerRole_surgeon}}"
                        },
                        "period": {
                            "start": "2025-11-15T12:00:00Z",
                            "end": "2025-11-15T12:20:00Z"
                        }
                    },
                    {
                        "function": {
                            "coding": [
                                {
                                    "system": "https://fhir.by/ValueSet/OperatingTeam",
                                    "code": "surgical-sister",
                                    "display": "медицинская сестра операционная"
                                }
                            ]
                        },
                        "actor": {
                            "reference": "PractitionerRole/{{PractitionerRole_sister}}"
                        },
                        "period": {
                            "start": "2025-11-15T12:00:00Z",
                            "end": "2025-11-15T12:20:00Z"
                        }
                    }
                ],
                "location": {
                    "reference": "Location/{{LocationId_surgeon}}"
                },
                "reason": [
                    {
                        "concept": {
                            "coding": [
                                {
                                    "system": "https://fhir.by/ValueSet/SurgicalInterventionDiagnosis",
                                    "code": "postoperative",
                                    "display": "Диагноз после вмешательства"
                                }
                            ]
                        },
                        "reference": {
                            "reference": "Condition/NailConditionTest"
                        }
                    }
                ],
                "note": [
                    {
                        "text": "Обработка операционного поля. Выполнено местное обезболивание. Иссечение вросшего края ногтевой пластины. Антисептическая обработка раны. Асептическая повязка"
                    }
                ]
            }
        }
    ]
}